<?php

namespace app\common\model;

use think\Model;

class Nav extends Model
{
    protected $autoWriteTimestamp = true;
    protected $createTime = 'createtime';
    protected $updateTime = false;

    public function getImageAttr($value, $data)
    {
        return !empty($value) ? cdnurl($value, true) : '';
    }

    public function items()
    {
        return $this->hasMany(Nav::class, 'pid', 'id');
    }

    public function services()
    {
        return $this->hasMany(Service::class, 'first', 'id');
    }
}